package com.appsindy.common.service.impl;

import java.util.List;

import org.apache.log4j.Logger;

import com.appsindy.common.bo.MenuLink;
import com.appsindy.common.dao.MenuLinkDAO;
import com.appsindy.common.service.AuthorizationServices;

public class AuthorizationServicesImpl implements AuthorizationServices {
	
	protected final Logger log = Logger.getLogger(getClass());
	private MenuLinkDAO menuLinkDAO;
	
	public List<MenuLink> getAllMenuLink(){
		log.info("[AuthorizationServices.getAllMenuLink]");
		List<MenuLink> list = getMenuLinkDAO().selectAllMenuLink();
		if(list != null){
			log.info("[AuthorizationServices.getAllMenuLink] list size = " + list.size());
		} else{
			log.info("[AuthorizationServices.getAllMenuLink] list is null ");
		}
		return list;
	}
	
	public List<MenuLink> getMenuLinkByLevel(int level){
		log.info("[AuthorizationServices.getMenuLinkByLevel]");
		List<MenuLink> list = getMenuLinkDAO().selectMenuLinkByLevel(level);
		if(list != null){
			log.info("[AuthorizationServices.getMenuLinkByLevel] list size = " + list.size());
		} else{
			log.info("[AuthorizationServices.getMenuLinkByLevel] list is null ");
		}
		return list;
	}
	
	public void addMenuLink(MenuLink menuLink){
		getMenuLinkDAO().insertMenuLink(menuLink);
	}
	
	public void updateMenuLink(MenuLink menuLink){
		getMenuLinkDAO().updateMenuLink(menuLink);
	}
	
	public void removeMenuLink(int id){
		getMenuLinkDAO().deleteMenuLink(id);
	}
	
	public MenuLinkDAO getMenuLinkDAO() {
		return menuLinkDAO;
	}
	public void setMenuLinkDAO(MenuLinkDAO menuLinkDAO) {
		this.menuLinkDAO = menuLinkDAO;
	}
	
}
